<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>v-for使用key</title>
</head>
<body>

<div id="app">
  <h2>:key  有key后，再在数组中间插入插入元素可以提高效率   app.letters.splice(2, 0, 'F')</h2>
  <h2>key的作用是可以高效的更新虚拟DOM 注意要保证key的唯一性</h2>
  <ul>
    <li v-for="item in letters" :key="item">{{item}}</li>
  </ul>
</div>
<script src="../js/vue.js"></script>
<script>
  const app = new Vue({
    el: '#app',
    data: {
      letters: ['A', 'B', 'C', 'D', 'E']
    }
  })
</script>
</body>
</html>
